package com.saclub.app.fragment;

import android.app.Dialog;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.offroader.core.OffRoaderApp;
import com.offroader.utils.PhoneUtils;
import com.saclub.app.R;

public abstract class BaseProgressBottomDialogFragment extends BaseProgressDialogFragment {
	
	@Override
	public void onStart() {
		super.onStart();

		initDialogLayout();
	}

	private void initDialogLayout() {
		//得到当前对话框对象（google不推荐直接创建dialog）
		Dialog dialog = getDialog();

		//得到对话框的窗体
		Window dialogWindow = dialog.getWindow();

		//设置窗体宽度全屏
		dialogWindow.setBackgroundDrawableResource(R.color.cl_common_page);
		int[] pixs = PhoneUtils.getScreenPix(OffRoaderApp.getInstance());
		WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes();
		layoutParams.width = pixs[0];
//		layoutParams.height = pixs[1] / 5 * 3;

		//设置窗体底部弹出
		layoutParams.gravity = Gravity.BOTTOM;

		//设置窗体弹出动画
		dialogWindow.setWindowAnimations(R.style.dialogWindowAnim);

		//设置窗体属性
		dialogWindow.setAttributes(layoutParams);
	}

}
